package mongo.db.clients.firsts;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class NetflowGenMainIPList {

	public static void main(String[] args) {
		ExecutorService routerExeService = Executors.newFixedThreadPool(300);
		
		List<Future<Integer>> futureList = new ArrayList<Future<Integer>>();
		for (int i = 0; i < 500; i++) {
			NetflowGenIPList threadObj = new NetflowGenIPList();
			futureList.add(routerExeService.submit(threadObj));
		}

		try {
			for (Future<Integer> future : futureList) {
				future.get();
			}
		} catch (Exception e) {
			System.out.println("Aggregator : " + e);
		}

		Date endTime = new Date();
		
		System.out.println("jobs successfully completed : " + futureList.size());
		futureList.clear();
		System.out.println("executor service shutting down....");
		routerExeService.shutdown();
	}

}
